import pyodbc
connection = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=PACS70D;UID=sa;PWD=sa')
cur=connection.cursor()

cur.execute("""
               select PatientID, Name
               from T_PPatient
            """)
i=0
for row in cur:
	i+=1
	print 'Title:',row.PatientID,'\t','content:',row.Name
print 'PPatient count:  ',i
cur.execute("delete T_PPatient")
print cur.rowcount, 'T_PPatient deleted'
connection.commit()
 
cur.execute("""
               select PatientID, Modality
               from T_PStudy 
            """)
i=0
for row in cur:
	i+=1
	print 'Title:',row.PatientID,'\t','content:',row.Modality
print 'T_PStudy  count:  ',i

